package com.wss.module.wan.ui.main.mvp.model;

import com.wss.common.base.mvp.BaseModel;
import com.wss.common.net.Api;
import com.wss.common.net.NetworkManage;
import com.wss.common.utils.NetworkUtil;
import com.wss.module.wan.bean.BannerInfo;
import com.wss.module.wan.bean.WXNumber;
import com.wss.module.wan.ui.main.mvp.contract.HomeContract;
import java.util.List;
import com.zhouyou.http.EasyHttp;
import com.zhouyou.http.callback.CallBack;
import com.zhouyou.http.callback.SimpleCallBack;
import ohos.aafwk.ability.ILifecycle;
import ohos.aafwk.ability.Lifecycle;

/**
 * Describe：首页Module
 * Created by 吴天强 on 2018/10/17.
 */
public class HomeModel extends BaseModel implements HomeContract.Model {

    public HomeModel(Lifecycle lifecycleOwner) {
        super(lifecycleOwner);
    }

    @Override
    public void getBanner(SimpleCallBack<List<BannerInfo>> callBack) {
        NetworkManage.createGet()
                .requestList(Api.GET_BANNER_LIST, callBack);
    }

    @Override
    public void getArticleList(int page, CallBack<String> callBack) {
        NetworkManage.createGet()
                .request(String.format(Api.GET_ARTICLE_LIST, page), callBack);
    }

    @Override
    public void getWxNumber(SimpleCallBack<List<WXNumber>> callBack) {

        NetworkManage.createGet()
                .requestList(Api.WX_NUMBER, callBack);
    }
}
